<template>
  <div>
    <el-pagination
    background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :page-sizes="[ 10, 30,  50, 80, 100]"
      layout="total, sizes, prev, pager, next, jumper"
      :current-page="currentPage"
      :page-size="pageSize"
      :total="total"
      class="botpage">
    </el-pagination>
  </div>
</template>

<script>
export default {
    data() {
      return {
        // currentPage: 1
      }
    },
    props: {
      'currentPage':{
        required: false,
        default:0
      },
      'total': {
        required: false,
        default: 0
      },
      'pageSize': {
        required: false,
        default: 10
      },
    
    },
    watch: {
      currentPage(val) {
        if (typeof val === "Number") {
          console.log('prop currentPage!!!');
          this.currentPage = val;
        }
      },
    },
    methods: {
      // 当前页变化
      handleCurrentChange(val) {
        this.$emit("handleCurrentChange", val);
      },
      // size变化
      handleSizeChange(val) {
        this.currentPage = 1;
        this.$emit('handleSizeChange', val);
      },
    }

  
};
</script>

<style>
.botpage {
  margin: 30px auto;
}
</style>